<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitScoreSku extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 转售记录
        Schema::create('asset_score_skus', function (Blueprint $table) {
            $table->comment = '积分套餐';
            
            $table->increments('id');
            $table->uuid('uuid')->index();

            $table->char('number')->nullable()->comment('编号');
            $table->char('thumb')->nullable()->comment('封面');

            $table->integer('money_price')->unsigned()->nullable()->comment('价格');
            $table->integer('score_price')->unsigned()->nullable()->comment('积分价格');

            $table->integer('discount_money_price')->unsigned()->nullable()->comment('价格');
            $table->integer('discount_score_price')->unsigned()->nullable()->comment('积分价格');

            $table->integer('score')->unsigned()->default(0)->comment('积分数量');
            $table->integer('stock')->unsigned()->default(0)->comment('库存');
            $table->integer('sales')->unsigned()->default(0)->index()->comment('销量');

            $table->integer('list_weight')->unsigned()->default(99)->comment('列表权重');  // 重量，单位为g

            $table->tinyInteger('status')->default(1)->index()->comment('0为下回中   1为上架中');  
            // 0为下回中   1为上架中

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('asset_score_skus');
    }
}
